src/Pure/General/seq.ML
changeset 21270 b82f4c16355e
parent 20332 27e4f43a0c3e
child 21395 f34ac19659ae
equal deleted inserted replaced
21269:c605503bb4ef 21270:b82f4c16355e
   185         | SOME (a, s') => pull (f (a, its s'))))
   185         | SOME (a, s') => pull (f (a, its s'))))
   186   in its xq end;
   186   in its xq end;
   187 
   187 
   188 
   188 
   189 
   189 
   190 (** sequence functions **)      (*some code copied from Pure/tctical.ML*)
   190 (** sequence functions **)      (*cf. Pure/tctical.ML*)
   191 
   191 
   192 fun succeed x = single x;
   192 fun succeed x = single x;
   193 fun fail _ = empty;
   193 fun fail _ = empty;
   194 
   194 
   195 fun op THEN (f, g) x = flat (map g (f x));
   195 fun op THEN (f, g) x = maps g (f x);
   196 
   196 
   197 fun op ORELSE (f, g) x =
   197 fun op ORELSE (f, g) x =
   198   (case pull (f x) of
   198   (case pull (f x) of
   199     NONE => g x
   199     NONE => g x
   200   | some => make (fn () => some));
   200   | some => make (fn () => some));