--- a/src/Pure/library.ML Thu Aug 25 09:23:13 2005 +0200
+++ b/src/Pure/library.ML Thu Aug 25 09:23:40 2005 +0200
@@ -13,6 +13,8 @@
union_string inter inter_int inter_string subset subset_int
subset_string;
+infix 2 ?;
+
infix 3 oo ooo oooo;
signature BASIC_LIBRARY =
@@ -30,6 +32,7 @@
val |>>> : ('a * 'c) * ('a -> 'b * 'd) -> 'b * ('c * 'd)
val #> : ('a -> 'b) * ('b -> 'c) -> 'a -> 'c
val #-> : ('a -> 'c * 'b) * ('c -> 'b -> 'd) -> 'a -> 'd
+ val ? : ('a -> bool) * ('a -> 'a) -> 'a -> 'a
val ` : ('b -> 'a) -> 'b -> 'a * 'b
val tap: ('b -> 'a) -> 'b -> 'b
val oo: ('a -> 'b) * ('c -> 'd -> 'a) -> 'c -> 'd -> 'b
@@ -320,6 +323,9 @@
fun f #> g = g o f;
fun f #-> g = uncurry g o f;
+(*conditional application*)
+fun b ? f = fn x => if b x then f x else x
+
(*view results*)
fun `f = fn x => (f x, x);
fun tap f x = (f x; x);