--- a/src/Pure/library.ML Tue Mar 14 22:06:43 2006 +0100
+++ b/src/Pure/library.ML Tue Mar 14 22:07:33 2006 +0100
@@ -104,6 +104,7 @@
exception UnequalLengths
val cons: 'a -> 'a list -> 'a list
val single: 'a -> 'a list
+ val singleton: ('a list -> 'b list) -> 'a -> 'b
val append: 'a list -> 'a list -> 'a list
val apply: ('a -> 'a) list -> 'a -> 'a
val fold: ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
@@ -493,6 +494,8 @@
fun cons x xs = x :: xs;
fun single x = [x];
+fun singleton f x = (case f [x] of [y] => y | _ => raise Empty);
+
fun append xs ys = xs @ ys;
fun apply [] x = x