1(*
2    Title:      Rebuild the basis library: list
3    Copyright   David C.J. Matthews 2016
4
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License version 2.1 as published by the Free Software Foundation.
8    
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13    
14    You should have received a copy of the GNU Lesser General Public
15    License along with this library; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17*)
18
19useBasis "ListSignature";
20
21structure List: LIST =
22struct
23    open List
24    val take = fn (l, i) => take(l, FixedInt.fromInt i)
25    val tabulate = fn (n, f) => tabulate(FixedInt.fromInt n, fn q => f(FixedInt.toInt q))
26    val length = fn l => FixedInt.toInt(length l)
27    val nth = fn (l, i) => nth(l, FixedInt.fromInt i)
28    val drop = fn (l, i) => drop(l, FixedInt.fromInt i)
29end;
30
31val length : 'a list -> int = List.length;
32